package org.zhq.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.zhq.service.OrderService;


@Component
@Slf4j
public class OrderJob {

    private final OrderService orderService;

    @Autowired
    public OrderJob(OrderService orderService) {
        this.orderService = orderService;
    }

    @Scheduled(cron = "0/3 0 * * * ?")
    public void autoCloseOrder(){
      log.info("execute orderJob");
      orderService.closeOrder();
    }
}
